package com.sac.approval.enums;

/**
 *审批line状态枚举类
 * @author xiaodong
 * @date 2018年10月16日 上午8:51:49
 * @desc
 */
public enum ApprovalLineStatusEnum {
	/**
	 * 未审批/进行中
	 */
	PENDING("Pending",0),
	/**
	 * 审批/同意
	 */
	APPROVED("Approved",1),
	/**
	 * 驳回/反推
	 */
	REJECT("Reject",2),
	/**
	 * 特批
	 */
	ARBITRARY("Arbitrary",3),
	/**
	 * 自动审批
	 */
	AUTO_APPROVED("Auto approved",5),
	/**
	 * 自动驳回
	 */
	AUTO_REJECT("Auto reject",6);

	private String name;
	private int value;

	private ApprovalLineStatusEnum(String name,int value) {
		this.name = name;
		this.value = value;
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		return this.name+"_"+this.value;
	}

	public static ApprovalLineStatusEnum getLineStatusEnumByValue(int value){
		for (ApprovalLineStatusEnum lineStatus :
				ApprovalLineStatusEnum.values()) {
			if (value==lineStatus.getValue()){
				return lineStatus;
			}
		}
		return null;
	}
}
